package com.hwl.lab.controller;

import com.hwl.lab.entity.Chronicfind;
import com.hwl.lab.entity.Institution;
import com.hwl.lab.service.ChronicfindService;
import com.hwl.lab.service.InstitutionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin //允许跨域请求
@RestController
public class ChronicfindController {

    @Autowired
    private ChronicfindService chronicfindService;
    //查询所有（分页）
    @GetMapping("/findChronicfindAll/{page}/{size}")
    public Page<Chronicfind> findAreaAll(@PathVariable("page") Integer page, @PathVariable("size") Integer size){
        return chronicfindService.findAll(page,size);
    }
    //查询所有不分页
    @GetMapping("/findChronicfindAll")
    public List<Chronicfind> findAll(){
        return chronicfindService.findAll();
    }

    //添加，修改
    @PostMapping("/saveChronicfind")
    public void saveInstitution(@RequestBody(required=false) Chronicfind chronicfind){
        chronicfindService.saveChronicfind(chronicfind);
    }

    //删除
    @PostMapping("/deleteChronicfind/{chronicfind}")
    public void deleteInstitution(@PathVariable("chronicfind") String chronicfindid){
        chronicfindService.deleteByChronicfind(chronicfindid);
    }
}
